cc.Class({
    extends: cc.Component,

    properties: {
        btnMusic:cc.Button,
        btnSound:cc.Button,
        btnClose:cc.Button,
        gameView:null,
        isMusicClose:cc.Node,
        isSoundClose:cc.Node,
    },

    onLoad () {
        let isOpenSound = window.gameConfig.getGameConfigData("isOpenSound");
        let isOpenMusic = window.gameConfig.getGameConfigData("isOpenMusic");

        if(isOpenSound == "0")this.isSoundClose.active = true;
        else this.isSoundClose.active = false;

        if(isOpenMusic == "0")this.isMusicClose.active = true;
        else this.isMusicClose.active = false;
    },

    //背景音乐
    onBtnMusicCheckEvent:function(){
        if(window.gameConfig.isOpenMusic == "1")
        {
            this.isMusicClose.active = true;
            window.audioMgr.prototype.playGameMusic(!this.isMusicClose.active);
            window.gameConfig.setGameMusic("0")
        }
        else
        {
            this.isMusicClose.active = false;
            window.audioMgr.prototype.playGameMusic(!this.isMusicClose.active);
            window.gameConfig.setGameMusic("1")
        }
    },

    //游戏音效
    onBtnSoundCheckEvent:function(){
        if(window.gameConfig.isOpenSound == "1")
        {
            this.isSoundClose.active = true;
            window.gameConfig.setGameSound(0)
        }
        else
        {
            this.isSoundClose.active = false;
            window.gameConfig.setGameSound(1)
        }
    },

    //关闭界面
    onBtnCloseCheckevent:function(){
        window.audioMgr.prototype.playButtonAudio();
        //销毁此节点
        removeNodeByParent(this.node)
    },
});
